diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-29 05:17:13 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-05-29 05:17:13 +0000 |
| commit | 37f55540833c2d5894513eca9fc8f7c6233fc2d2 (patch) | |
| tree | 6807978e7150358b3444c33b825c83e2c9cda8e8 /app/[lng]/evcp/(evcp)/items/page.tsx | |
| parent | 4b9bdb29e637f67761beb2db7f75dab0432d6712 (diff) | |
(대표님) 0529 14시 16분 변경사항 저장 (Vendor Data, Docu)
Diffstat (limited to 'app/[lng]/evcp/(evcp)/items/page.tsx')
| -rw-r--r-- | app/[lng]/evcp/(evcp)/items/page.tsx | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/app/[lng]/evcp/(evcp)/items/page.tsx b/app/[lng]/evcp/(evcp)/items/page.tsx index 144689ff..31dcaf11 100644 --- a/app/[lng]/evcp/(evcp)/items/page.tsx +++ b/app/[lng]/evcp/(evcp)/items/page.tsx @@ -1,7 +1,7 @@ +// app/items/page.tsx (업데이트) import * as React from "react" import { type SearchParams } from "@/types/table" -import { getValidFilters } from "@/lib/data-table" import { Skeleton } from "@/components/ui/skeleton" import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton" import { Shell } from "@/components/shell" @@ -9,7 +9,6 @@ import { searchParamsCache } from "@/lib/items/validations" import { getItems } from "@/lib/items/service" import { ItemsTable } from "@/lib/items/table/items-table" - interface IndexPageProps { searchParams: Promise<SearchParams> } @@ -17,16 +16,21 @@ interface IndexPageProps { export default async function IndexPage(props: IndexPageProps) { const searchParams = await props.searchParams const search = searchParamsCache.parse(searchParams) + + // pageSize 기반으로 모드 자동 결정 + const isInfiniteMode = search.perPage >= 1_000_000 - const validFilters = getValidFilters(search.filters) - - const promises = Promise.all([ - getItems({ - ...search, - filters: validFilters, - }), + console.log('Page searchParams:', searchParams) + console.log('Parsed search:', search) + console.log('isInfiniteMode (pageSize >= 1M):', isInfiniteMode) - ]) + // 페이지네이션 모드일 때만 서버에서 데이터 가져오기 + // 무한 스크롤 모드에서는 클라이언트에서 SWR로 데이터 로드 + const promises = isInfiniteMode + ? null + : Promise.all([ + getItems(search), // searchParamsCache의 결과를 그대로 사용 + ]) return ( <Shell className="gap-2"> @@ -37,25 +41,21 @@ export default async function IndexPage(props: IndexPageProps) { Package Items </h2> <p className="text-muted-foreground"> - Item을 등록하고 관리할 수 있습니다.{" "} - {/* <span className="inline-flex items-center whitespace-nowrap"> - <Ellipsis className="size-3" /> - <span className="ml-1">버튼</span> - </span> - 을 통해 담당자 연락처, 입찰 이력, 계약 이력, 패키지 내용 등을 확인 할 수 있습니다. */} + {/* Item을 등록하고 관리할 수 있습니다. */} + {isInfiniteMode && ( + <span className="ml-2 text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded"> + 무한 스크롤 모드 + </span> + )} </p> </div> </div> </div> <React.Suspense fallback={<Skeleton className="h-7 w-52" />}> - {/* <DateRangePicker - triggerSize="sm" - triggerClassName="ml-auto w-56 sm:w-60" - align="end" - shallow={false} - /> */} + {/* DateRangePicker 등 추가 컴포넌트 */} </React.Suspense> + <React.Suspense fallback={ <DataTableSkeleton @@ -67,8 +67,9 @@ export default async function IndexPage(props: IndexPageProps) { /> } > + {/* 통합된 ItemsTable 컴포넌트 사용 */} <ItemsTable promises={promises} /> </React.Suspense> </Shell> ) -} +}
\ No newline at end of file |
